import { defineView } from "@/routers/tools.mjs";

/**
 * @type {DefineView}
 */
const ngHrefView = defineView({
  controller: [
    "$scope",
    /**
     * @param {ng.IScope & {value: string}} $scope
     */
    ($scope) => {
      $scope.value = "";
    },
  ],
  template: /* HTML */ html`
    <input ng-model="value" />
    <br />
    <!-- <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br /> -->
    <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't
    reload)<br />
    <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
    <a id="link-4" href="" name="xx" ng-click="value = 4">anchor 4</a> (link,
    don't reload)<br />
    <a id="link-5" name="xxx" ng-click="value = 5">anchor 5</a> (no link)<br />
    <a id="link-6" ng-href="{{value}}">link 6</a> (link, change location)
  `,
});

export default ngHrefView;
